package singleResponsibility;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: fzykd
 * Date: 2023-02-28
 * Time: 15:36
 */

public class SingleRes2 {
    public static void main(String[] args) {
        LSVehicle lsVehicle = new LSVehicle();
        lsVehicle.run("汽车");
        TSVehicle tsVehicle = new TSVehicle();
        tsVehicle.run("飞机");
        SLVehicle slVehicle = new SLVehicle();
        slVehicle.run("轮船");
    }
}
// 这个方案 遵守单一职责原则
// 但是这样修改的改动很大 将整个类分解 同时修改客户端
// 还可以将vehicle这个类 不用分解 在类中创建不同的方法

class LSVehicle{
    public void run(String vehicle){
        System.out.println(vehicle + "路上跑的!");
    }
}

class TSVehicle{
    public void run(String vehicle){
        System.out.println(vehicle + "天上飞的");
    }
}

class SLVehicle{
    public void run(String vehicle){
        System.out.println(vehicle + "水里游的");
    }
}
